<?php
/* @var $this CommentController */
/* @var $model Comment */

$this->breadcrumbs = array(
    'Comments' => HSUrl::backendCommentUrl()
);
Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
    $('.search-form').toggle();
    return false;
});
$('.search-form form').submit(function(){
    $('#comment-grid').yiiGridView('update', {
        data: $(this).serialize()
    });
    return false;
});
");
?>
<?php echo CHtml::link('Advanced Search', '#', array('class' => 'search-button')); ?>
<div class="search-form" style="display:none">
    <?php $this->renderPartial('_search', array(
        'model' => $model,
    )); ?>
</div><br/>
<br/>

<div id="" class="admin-main-wrapper form-inline">
    <div class="dataTables_wrapper">
        <?php $this->widget('zii.widgets.grid.CGridView', array(
            'id' => 'comment-grid',
            'dataProvider' => $model->search(),
            'filter' => $model,
            'columns' => array(
                'id',
                'email',
                'username',
                'content',
                array('name' => 'published', 'value' => '$data->published ?"Có" :"Không"'),
                array(
                    'class' => 'CButtonColumn',
                    'template' => '{update}{delete}',
                ),
                array(
                    'class' => 'CButtonColumn',
                    'template' => '{published} {unPublished}',
                    'buttons' => array(
                        'published' => array
                        (
                            'label' => 'Yes',
                            'url' => 'HSUrl::publishedCommentUrl($data->id,1)',
                        ),
                        'unPublished' => array
                        (
                            'label' => 'No',
                            'url' => 'HSUrl::publishedCommentUrl($data->id,0)',
                        ),
                    )
                ),

            ),
        )); ?>
    </div>
</div>